import 'package:flutter/material.dart';
import 'package:flutter_app/components/layout.dart';
class VipPage extends StatefulWidget {
  @override
  _VipPageState createState() => _VipPageState();
}
Widget HeadContainer(String text,{Widget right}){
  return Padding(
    padding: const EdgeInsets.symmetric(vertical: 10.0),
    child: RowBetween(
      children: [
        Row(
          children: [
            SizedBox(
              width: 4,
              height:15,
              child: DecoratedBox(
                decoration: BoxDecoration(color: Colors.blueAccent),
              ),
            ),
            SizedBox(
              width:8
            ),
            Text(text,style: TextStyle(fontSize: 16,fontWeight: FontWeight.w500),),
          ],
        ),
        Offstage(offstage: right == null,child: right)
      ],
    ),
  );
}
Widget RightContainer(String text,{String img}){
  return Column(
    children: [
      Image.asset(img??"",width: 30,),
      Text(text,style: TextStyle(fontSize: 12,color: Colors.black,fontWeight: FontWeight.w500),)
    ],
  );
}
class _VipPageState extends State<VipPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: DarkHeadBar(
          '会员中心',
        actions: [
          TextButton(onPressed:(){Navigator.pushNamed(context, '/vip/rule');},child: Text('等级规则',style: TextStyle(fontSize: 13,color: Colors.black),),)
        ]
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 20.0),
        child: Column(
          children: [
          //  会员
          //  财富更新时间
           Container(
             padding: EdgeInsets.symmetric(horizontal: 10.0,vertical: 10.0),
             decoration: BoxDecoration(
               color: Colors.grey.withOpacity(0.1),
               borderRadius: BorderRadius.circular(5.0)
             ),
             child: Row(
               children: [
                 Text('下次财富分更新时间：本周五 08:00',style: TextStyle(fontSize: 12),)
               ],
             ),
           ),
          SizedBox(
            height: 30.0,
          ),
          //  会员权益
            HeadContainer('会员权益'),
            Row(
              children: [
                RightContainer(
                    'VIP财富群'
                ),
                RightContainer(
                    '专属顾问'
                ),
                RightContainer(
                    '定制产品'
                )
              ],
            ),
          SizedBox(
            height: 30,
          ),
          //  每月会员奖励
            HeadContainer('每月会员奖励',right:Text('每月一号更新',style: TextStyle(color: Colors.grey,fontSize: 12),)),
          //  提高财富分
            HeadContainer('提高财富分'),
          ],
        ),
      ),
    );
  }
}
